load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "sqlutils",
    srcs = [
        "inject.go",
        "parse.go",
        "pg_url.go",
        "pretty.go",
        "rows.go",
        "scrub.go",
        "sql_runner.go",
        "table_gen.go",
        "table_id.go",
        "util_mutiltregion.go",
        "zone.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config/zonepb",
        "//pkg/keys",
        "//pkg/security/certnames",
        "//pkg/security/securitytest",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/lexbase",
        "//pkg/sql/parser",
        "//pkg/sql/parser/statements",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/plpgsql/parser:plpgparser",
        "//pkg/sql/protoreflect",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/tree",
        "//pkg/testutils",
        "//pkg/util/fileutil",
        "//pkg/util/protoutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_cockroach_go_v2//crdb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_lib_pq//:pq",
        "@com_github_stretchr_testify//require",
    ],
)

go_test(
    name = "sqlutils_test",
    size = "medium",
    srcs = [
        "inject_test.go",
        "main_test.go",
        "sql_runner_test.go",
        "table_gen_test.go",
    ],
    embed = [":sqlutils"],
    deps = [
        "//pkg/base",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/sql/catalog/descpb",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "@com_github_stretchr_testify//require",
    ],
)
